/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.za.designPatterns.creational.builder.factory;

import ac.za.designPatterns.creational.builder.model.MealOrder;

/**
 *
 * @author 210012285
 */
public class MealBuilder {
    
    public static class  Builder{
    //mandatory
    private String burger;
    
    //optional
    private String drink;
    private String iceCream;
    private String chips;
    private String toys;
    
    //show mondatory property with a constructor
    public Builder(String burger){
    
    this.burger = burger;
    }
    
    
    public Builder drink(String drink){
    
        this.drink = drink;
        return this;
    }
    public Builder iceCream(String iceCream){
    
        this.iceCream = iceCream;
        return this;
    }
    public Builder chips(String chips){
    
        this.chips = chips;
        return this;
    }
    public Builder toys(String toys){
    
        this.toys = toys;
        return this;
    }
    
    public MealOrder build(){
        return getMealOrder(this);
        
    }
    
    private MealOrder getMealOrder(Builder builder){
            
        MealOrder mealOrder = new MealOrder();
        
        mealOrder.setBurger(builder.burger);
        mealOrder.setChips(builder.chips);
        mealOrder.setDrink(builder.drink);
        mealOrder.setIceCream(builder.iceCream);
        mealOrder.setToys(builder.toys);
        
        return mealOrder;
        
        
    }
    }
    
}
